import React from 'react';
import { Result, Button } from 'antd';
import { useHistory } from 'react-router-dom';

const Unauthorized = () => {
  const history = useHistory();

  const handleGoBack = () => {
    history.goBack();
  };

  const handleGoHome = () => {
    history.push('/');
  };

  return (
    <Result
      status="403"
      title="403"
      subTitle="抱歉，您没有权限访问此页面。"
      extra={[
        <Button type="primary" key="goBack" onClick={handleGoBack}>
          返回上一页
        </Button>,
        <Button key="goHome" onClick={handleGoHome}>
          返回首页
        </Button>,
      ]}
    />
  );
};

export default Unauthorized; 